<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<jsp:include page="header.jsp" />
<f:view>
	<h:form>
		<h:panelGroup layout="block" styleClass="t">
			<h:panelGroup layout="block" styleClass="b">
				<h:panelGroup layout="block" styleClass="l">
					<h:panelGroup layout="block" styleClass="r">
						<h:panelGroup layout="block" styleClass="bl">
							<h:panelGroup layout="block" styleClass="br">
								<h:panelGroup layout="block" styleClass="tl">
									<h:panelGroup layout="block" styleClass="tr">

										<h:panelGrid columns="1" styleClass="gridtable"
											cellspacing="0" cellpadding="5" border="0"
											rendered="#{empty supplierBean.suppliers}" captionClass="gridtools">
											<f:facet name="caption">	
												<h:panelGroup>
													<h:panelGroup layout="block">											
														<h:outputText value="Suppliers"></h:outputText>
													</h:panelGroup>
													<h:outputLink value="supplier_edit.jsp">
														<h:outputText value="New Supplier" />
													</h:outputLink>
													
												</h:panelGroup>
											</f:facet>
											<h:outputText value="No records to display" styleClass="noRecordsMessage"/>
										</h:panelGrid>

										<h:dataTable styleClass="gridtable" cellspacing="0"
											cellpadding="5" border="0" value="#{supplierBean.suppliers}"
											var="supplier" rendered="#{not empty supplierBean.suppliers}"
											rowClasses="white_row,color_row"
											columnClasses=",,,lastColumn" captionClass="gridtools"
											>
											<f:facet name="caption">
												<h:panelGroup>
													<h:panelGroup layout="block">											
														<h:outputText value="Suppliers"></h:outputText>
													</h:panelGroup>
													<h:outputLink value="supplier_edit.jsp">
														<h:outputText value="New Supplier" />
													</h:outputLink>
													
												</h:panelGroup>
											</f:facet>

											<h:column>
												<f:facet name="header">
													<h:outputText value="Id"></h:outputText>
												</f:facet>
												<h:outputText value="#{supplier.id}" />
											</h:column>
											<h:column>
												<f:facet name="header">
													<h:outputText value="Name"></h:outputText>
												</f:facet>
												<h:outputText value="#{supplier.name}" />
											</h:column>
											<h:column>
												<f:facet name="header">
													<h:outputText value="Address"></h:outputText>
												</f:facet>
												<h:outputText value="#{supplier.address}" />
											</h:column>
											<h:column>
												<f:param name="align" value="right"></f:param>
												<h:outputLink  value="supplier_edit.jsp">
													<f:param name="supplierId" value="#{supplier.id}" />
													<f:param name="action" value="edit" />
													<h:graphicImage alt="Edit Supplier" title="Edit Supplier" value="./res/img/edit.gif"></h:graphicImage>
												</h:outputLink>
												<h:outputText value=" "></h:outputText>
												<h:commandLink action="#{supplierBean.deleteSupplier}" onclick="if(!confirm('Are you sure you want to delete this supplier?'))return false;">
													<f:setPropertyActionListener target="#{supplierBean.supplier}" value="#{supplier}" />
													<h:graphicImage alt="Delete Supplier" title="Delete Supplier" value="./res/img/trash2.gif"></h:graphicImage>													
												</h:commandLink>
											</h:column>
										</h:dataTable>



									</h:panelGroup>
								</h:panelGroup>
							</h:panelGroup>
						</h:panelGroup>
					</h:panelGroup>
				</h:panelGroup>
			</h:panelGroup>
		</h:panelGroup>
	</h:form>
</f:view>

<jsp:include page="footer.jsp" />
